package ch.fusun.baron.player.api;

import java.util.List;
import java.util.Map;

import ch.fusun.baron.core.rmi.User;
import ch.fusun.baron.data.DataProvider;
import ch.fusun.baron.player.Dynasty;
import ch.fusun.baron.player.Gender;
import ch.fusun.baron.player.Player;

/**
 * The service for player manipulation
 */
public interface PlayerService extends DataProvider {

	/**
	 * @param user
	 *            The parent user
	 * @return the associated players
	 */
	List<Player> getPlayers(User user);

	/**
	 * @param players
	 *            Sets the all the players
	 */
	void setDynasties(Map<Dynasty, User> players);

	/**
	 * @param dynasty
	 * @param user
	 */
	void setDynastyForUser(Dynasty dynasty, User user);

	/**
	 * @return Gets all the players in the game
	 */
	List<Player> getAllPlayers();

	/**
	 * @param dynasty
	 *            The dynasty
	 * @return The associated user
	 */
	User getUser(Dynasty dynasty);

	/**
	 * @param user
	 *            The associated user
	 * @return All the dynasties of the user
	 */
	Dynasty getDynasty(User user);

	/**
	 * @return All dynasties in the game
	 */
	List<Dynasty> getAllDynasties();

	/**
	 * Gets the dynasty of the player
	 * 
	 * @param player
	 *            The player
	 * @return The dynasty of the player
	 */
	Dynasty getDynasty(Player player);

	/**
	 * Generates a name fitting to the gender
	 * 
	 * @param gender
	 *            The gender of the name
	 * @return A random name
	 */
	String generateName(Gender gender);

	/**
	 * Adds a new player to the Dynasty
	 * 
	 * @param dynasty
	 *            The dynasty
	 * @param child
	 *            The new player
	 */
	void addPlayerToDynasty(Dynasty dynasty, Player child);

	/**
	 * Generates a new player with a unique ID
	 * 
	 * @param gender
	 *            the gender
	 * @return The created player
	 */
	Player generateNewPlayer(Gender gender);

	/**
	 * @param person
	 *            The player to update
	 */
	void updatePlayer(Player person);

	/**
	 * @param playersToRemove
	 *            All the players that should be removed
	 */
	void removePlayers(List<Player> playersToRemove);
}
